home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / uw_1.exe / UW_TUT3.C < prev    next >
Text File  |  1992-11-13  |  4KB  |  73 lines

  1. /****************************************************************************/
  2. /* UW_TUT3.C                                                                */
  3. /*                                                                          */
  4. /* NOTE: THIS FILE IS PUBLIC DOMAIN AND MAY BE MODIFIED AND USED AT WILL    */
  5. /*                                                                          */
  6. /* Next, we setup a fullscreen background or desktop window and demonstrate */
  7. /* the use of the window manager.                                           */
  8. /*                                                         Dr. Boyd Gafford */
  9. /*                                                         Kevin Huck       */
  10. /*                                                         EnQue Software   */
  11. /*                                                         08/31/92         */
  12. /****************************************************************************/
  13. #include <ctype.h>
  14. #include "uw.h"                           /* include the necessary headers  */
  15.  
  16. /*----------------------- global window variables --------------------------*/
  17. WINDOW   Desk_window, Window1;
  18.  
  19. /*********/
  20. /* ~main */
  21. /*       ********************************************************************/
  22. /*  Demonstrate window manager...                                           */
  23. /****************************************************************************/
  24. int main()
  25. {
  26.   WINDOW *wnp;
  27.   
  28.   wnp = &Window1;                         /* set local window pointer       */
  29.   init_video(80, 25);                     /* init video for 80 x 25 screen  */
  30.   init_clock(0x3333);                     /* init clock irq at 91 tics/sec  */
  31.  
  32. /*-------- Here we create a fullscreen desktop window and add it -----------*/
  33. /*-------- to the window manager using link_window. This sets it -----------*/
  34. /*-------- on the screen and puts it under the manager's control -----------*/ 
  35.   wn_create(0, 0, V_cols-1, V_rows-1, NO_BDR, WN_NORMAL, &Desk_window);
  36.   link_window(&Desk_window);
  37.   wn_plst( CENTERED, 12, "This is the background window", &Desk_window);
  38.   wait_event();
  39.   
  40. /*-------- Do the same for the other window.  Note that this     -----------*/
  41. /*-------- window does not need to be a popup as the window      -----------*/
  42. /*-------- manager will automatically restore the area under the -----------*/ 
  43. /*-------- window when removed by the function unlink_window     -----------*/ 
  44.   wn_create(20, 5, 60, 20, SLD_BDR, WN_NORMAL, wnp);
  45.   wn_color(YELLOW, BLUE, wnp);            /* change the window colors       */
  46.   wn_bdr_color(WHITE, BLUE, wnp);         /* change the border's colors     */
  47.   link_window(wnp);
  48.   
  49.   wn_plst( CENTERED, 7, "This is the top window", wnp);
  50.   wait_event();                           /* wait for a keystroke           */
  51.  
  52. /*-------- Now, here's the slick part.  The top window is        -----------*/
  53. /*-------- "over" the first string we wrote; however, we will    -----------*/
  54. /*-------- write another string below the first one.  You will   -----------*/ 
  55. /*-------- not see the output until the top window is removed.   -----------*/ 
  56. /*-------- In this way, using the manager, you never have to     -----------*/ 
  57. /*-------- worry about wether a window is overlapped or not!     -----------*/ 
  58.   wn_plst( CENTERED,  8, "Writing to background window", wnp);
  59.   wn_plst( CENTERED, 13, "------------- This was written while overlapped! ------------", &Desk_window);
  60.   wn_plst( CENTERED,  9, "Done - hit a key to remove window", wnp);
  61.   wait_event(); 
  62.   unlink_window(wnp);                     /* remove the window from screen, */
  63.   wn_destroy(wnp);                        /* and destroy it                 */
  64.   wait_event();
  65.   unlink_window(&Desk_window);            /* remove the window from screen  */
  66.   wn_destroy(&Desk_window);               /* and destroy it                 */
  67.   end_video();                            /* clean up before we exit        */
  68.   return(1);
  69. }
  70. /*** end of main ***/
  71.  
  72. /*** END OF FILE ***/
  73.